//
//  ERReaderViewController.m
//  EpubReader
//
//  Created by zhuxuhong on 2016/12/14.
//  Copyright © 2016年 zhuxuhong. All rights reserved.
//

#import "ERReaderViewController.h"
#import "ERReaderView.h"

@interface ERReaderViewController ()

@property(nonatomic,copy)ERReaderView *readerView;

@end

@implementation ERReaderViewController

#pragma mark - initial

#pragma mark - lifecycle
- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.view addSubview:self.readerView];
}

#pragma mark - getters
-(ERReaderView *)readerView{
    if (!_readerView) {
        ERReaderView *rv = [[ERReaderView alloc]initWithFrame:self.view.bounds];
        rv.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        NSString *str = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"demo.html" ofType:nil] encoding:NSUTF8StringEncoding error:nil];
        rv.bookText = str;
        
        _readerView = rv;
    }
    return _readerView;
}

#pragma mark - setters


#pragma mark - private
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
    [_readerView reloadData];
}



#pragma mark - public




@end
